*********************************************************
*********************************************************  
*** GBR 2024 --- JPE Revision Package *******************
*** Code for stats analyses, Study 5 ********************
*** Public (anonymized) *********************************
*********************************************************

**************************
**** Clean Data  *********
**************************

clear all
set more off

cd ".../JPEReplicationPackageDataverse/"
do GBR24CleaningStudy5.do



**************************
**** Data Preparation ****
**************************

clear all
set more off

** Load dataset from Study 5
use ".../JPEReplicationPackageDataverse/GBR24DataCleanStudy5.dta"

destring, replace



**************************
*** Text in section VI.B *
**************************



** Percentage of respondents whose work motivation decreased because of discrimination (86%) and median duration (6 months)
tab Q_motiva
di 46.38+39.40
tab motivation_change
tab Q_motiva_duration
di 3.91+12.01+20.67+27.09
sum motivation_change_duration, detail

** Percentage of respondents who decreased their weekly work hours because of discrimination (12%), median decrease (10h), and median duration (6 months)
tab Q_hours1_formalhours
di 3.74+1+2.49+0.75+1+2.99
tab formal_hours_change
sum formal_hours_change if formal_hours_change<=5, detail
tab Q_hours_duration
di 7.37+16.59+23.96+23.04
sum hours_change_duration, detail

** Percentage of respondents who took longer break because of discrimination (37%) and median duration (6 months)
tab Q_hours3_breaks
tab break_length_change
tab Q_hours_duration
di 7.37+16.59+23.96+23.04
sum hours_change_duration, detail

** Percentage of respondents whose work productivity decreased because of discrimination (61%) and median duration (6 months)
tab Q_produc
di 39.65+21.70
tab workproductivity_change
tab Q_produc_duration
di 4.41+15.07+23.16+24.26 
sum workproductivity_change_duration, detail

** Percentage of respondents who left job for any reasons and who left job because of discrimination
* Left job for any reasons (58%)
tab Q_leavejob 
di 100-41.65
tab leavejob_anyreason
di 100-41.65
* Left job within around one year (47%)
tab Q_leavejob 
di (29+7+56+47+51)/401
tab leavejob_anyreason
di 100-52.62
* Percentage who left job because of discrimination within around one year (29% of full sample)
tab Q_leavejob if Q_leavejob_discrim=="Yes"
di (21+7+28+31+31)/401
tab leavejob_anyreason if Q_leavejob_discrim=="Yes"
di (133-15)/401
* Percentage who left job because for other reason within around one year (18% of full sample)
tab Q_leavejob if Q_leavejob_discrim=="No"
di (8+28+16+20)/401
tab leavejob_anyreason if Q_leavejob_discrim=="No"
di (101-29)/401

** Percentage of respondents who did not take new job among respondents who left job within around one year because of discrimination (13%)
tab Q_leavejob_newjob if Q_leavejob_discrim=="Yes" & Q_leavejob!="Yes, around 1.5 year after or more"

** Percentage of respondents whose work productivity decreased because of discrimination conditional on not quitting job within about a year (55%)
tab Q_produc if Q_leavejob=="No, I did not" | Q_leavejob=="Yes, around 1.5 year after or more"
di 19.43+35.07
tab workproductivity_change if Q_leavejob=="No, I did not" | Q_leavejob=="Yes, around 1.5 year after or more"

** Percentage of respondents who decreased their weekly work hours because of discrimination conditional on not quitting job within about a year (12.3%)
tab Q_hours1_formalhours if Q_leavejob=="No, I did not" | Q_leavejob=="Yes, around 1.5 year after or more"
di 3.79+1.9+3.32+0.95+2.37
tab formal_hours_change if leavejob_anyreason==0 | leavejob_anyreason==1

** Percentage of reported discrimination (57%)
tab Q_report
** Percentage of respondents who state that their employer took sufficient measures  rectify discrimination and to prevent it from occurring again, conditional on having reported discrimination (5%)
tab Q_employer_measures if Q_report=="Yes"
